package com.java8.ch06;

/**
 * This program includes a method inside the box class.
 * 
 * @author Administrator
 *
 */
public class BoxDemo3 {

	public static void main(String[] args) {
		BoxThree mybox1 = new BoxThree();
		double vol;
		// assign values to mybox1's instance variable
		mybox1.width = 3;
		mybox1.height = 6;
		mybox1.depth = 9;

		// display volume of mybox1
		mybox1.volume();

		BoxThree mybox2 = new BoxThree();
		// assign values to mybox2's instance variable
		mybox2.width = 10;
		mybox2.height = 20;
		mybox2.depth = 15;

		// display volume of mybox2
		mybox2.volume();
	}
}

class BoxThree {

	double width;
	double height;
	double depth;

	// display volume of a box
	void volume() {
		System.out.println("Volume is " + width * height * depth);
	}
}
